﻿function Evolution_Pawp_HidePageElements(siteActionId, flags, error, request) {
    if (flags == 0 && request) {
        if (error != "")
            alert(error);            
        return;
    }
    if ((flags & 2) == 2) {
        // Quick Launch
        var quickLaunchTd = document.getElementById("LeftNavigationAreaCell");
        if(quickLaunchTd)
            quickLaunchTd.innerHTML = "";

        document.write("<style type=\"text/css\">TD.ms-leftareacell  TABLE.ms-nav  TABLE.ms-navframe { display: none; } TD.ms-titlearealeft  DIV.ms-titleareaframe { display: none; }</style>");            
    }
    if ((flags & 4) == 4) {
        // Recycle Bin
        document.write("<style type=\"text/css\">.ms-recyclebin { display:none; }</style>");
    }
    if ((flags & 8) == 8) {
        // View All Site Content
        document.write("<style type=\"text/css\">.ms-quicklaunchheader { display:none; }</style>");

        var viewAllContent = document.getElementById(siteActionId + "_ctl00_wsaViewAllContent");
        if (viewAllContent != null) {
            viewAllContent.parentNode.removeChild(viewAllContent);
        }
    }       
    if ((flags & 16) == 16) {
        // Create Page
        var createPage = document.getElementById(siteActionId + "_ctl00_wsaCreatePage");
        if (createPage != null)
            createPage.parentNode.removeChild(createPage);        
    }
    if ((flags & 32) == 32) {
        // Edit Page
        var editPage1 = document.getElementById(siteActionId + "_ctl00_MenuItem_EditPage");        
        if (editPage1 != null)
            editPage1.parentNode.removeChild(editPage1);

        var editPage2 = document.getElementById(siteActionId + "_ctl00_wsaEditPage");            
        if (editPage2 != null)
            editPage2.parentNode.removeChild(editPage2);

        var showEditToolbar = document.getElementById(siteActionId + "_ctl00_wsaShowMenu");
        if (showEditToolbar != null)
            showEditToolbar.parentNode.removeChild(showEditToolbar);
    }

}

function Evolution_Pawp_ToggleText(img, id) {
var text = document.getElementById(id);
    if (text.style.display == "block") {
        text.style.display = "none";
        img.src = "/_layouts/images/plus.gif";
    }
    else {
        text.style.display = "block";
        img.src = "/_layouts/images/minus.gif";
    }
}

function Evolution_Pawp_DisableMenu(id) {
    var a = document.getElementById("WebPart" + id + "_MenuLink");
    if (a != null) {
        a.disabled = true;
        a.onclick = "return;";
        a.href = "#";
    }
}